{% extends 'base.html' %}
{% load static %}

{% block title %}积分规则 - 活动社交平台{% endblock %}

{% block content %}
<div class="container mt-4">
    <div class="row">
        <div class="col-12">
            <div class="d-flex justify-content-between align-items-center mb-4">
                <h4>积分规则</h4>
                <div>
                    <a href="{% url 'points_mall' %}" class="btn btn-outline-primary">
                        <i class="fas fa-gift"></i> 积分商城
                    </a>
                    <a href="{% url 'points_history' %}" class="btn btn-outline-success">
                        <i class="fas fa-history"></i> 积分历史
                    </a>
                </div>
            </div>

            <!-- 积分规则列表 -->
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title mb-0">积分获取规则</h5>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>规则名称</th>
                                    <th>积分值</th>
                                    <th>每日上限</th>
                                    <th>描述</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for rule in rules %}
                                <tr>
                                    <td>
                                        <strong>{{ rule.name }}</strong>
                                        {% if rule.is_active %}
                                        <span class="badge bg-success ms-2">启用</span>
                                        {% else %}
                                        <span class="badge bg-secondary ms-2">禁用</span>
                                        {% endif %}
                                    </td>
                                    <td>
                                        <span class="text-success">+{{ rule.points }}</span>
                                    </td>
                                    <td>
                                        {% if rule.daily_limit > 0 %}
                                        {{ rule.daily_limit }} 次/天
                                        {% else %}
                                        <span class="text-muted">无限制</span>
                                        {% endif %}
                                    </td>
                                    <td>{{ rule.description }}</td>
                                </tr>
                                {% empty %}
                                <tr>
                                    <td colspan="4" class="text-center py-4">
                                        <i class="fas fa-info-circle fa-2x text-muted mb-3"></i>
                                        <p class="text-muted">暂无积分规则</p>
                                    </td>
                                </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <!-- 积分使用说明 -->
            <div class="card mt-4">
                <div class="card-header">
                    <h5 class="card-title mb-0">积分使用说明</h5>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-6">
                            <h6><i class="fas fa-shopping-cart text-primary me-2"></i>积分兑换</h6>
                            <ul class="list-unstyled">
                                <li><i class="fas fa-check text-success me-2"></i>在积分商城中兑换各类奖品</li>
                                <li><i class="fas fa-check text-success me-2"></i>虚拟商品即时发放兑换码</li>
                                <li><i class="fas fa-check text-success me-2"></i>实物商品需要填写收货信息</li>
                            </ul>
                        </div>
                        <div class="col-md-6">
                            <h6><i class="fas fa-gift text-success me-2"></i>奖品类型</h6>
                            <ul class="list-unstyled">
                                <li><i class="fas fa-ticket-alt text-info me-2"></i>活动优惠券</li>
                                <li><i class="fas fa-crown text-warning me-2"></i>平台特权</li>
                                <li><i class="fas fa-box text-primary me-2"></i>实体奖品</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 注意事项 -->
            <div class="alert alert-info mt-4">
                <h6><i class="fas fa-exclamation-circle me-2"></i>注意事项</h6>
                <ul class="mb-0">
                    <li>积分有效期为自获得之日起1年</li>
                    <li>积分不可转让、不可兑换现金</li>
                    <li>如发现作弊行为，平台有权取消积分并封禁账号</li>
                    <li>积分规则如有变更，将提前通知用户</li>
                </ul>
            </div>
        </div>
    </div>
</div>
{% endblock %}